<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>可修改和复制文本</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            text-align: center;
        }

        .container {
            max-width: 600px;
            margin: auto;
        }

        textarea {
            width: 100%;
            height: 500px;
            resize: vertical;
            padding: 10px;
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 5px;
            box-sizing: border-box;
        }

        button {
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            border: none;
            border-radius: 5px;
            outline: none;
            margin-top: 10px;
            width: 90%;
        }

        button:hover {
            background-color: #45a049;
        }

        @media (max-width: 600px) {
            .container {
                padding: 10px;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <textarea id="text-to-copy" placeholder="请输入要复制的文本"><?php echo file_get_contents('video.txt'); ?></textarea>
    <button onclick="copyText()">一键复制文本</button>
</div>

<script>
    function copyText() {
        // 获取要复制的文本
        const textToCopy = document.getElementById('text-to-copy').value;

        // 创建一个临时的 textarea 元素
        const tempTextArea = document.createElement('textarea');
        tempTextArea.value = textToCopy;
        document.body.appendChild(tempTextArea);

        // 选中 textarea 内容
        tempTextArea.select();
        tempTextArea.setSelectionRange(0, 99999); // For mobile devices

        // 复制选中的内容
        document.execCommand('copy');

        // 删除临时的 textarea 元素
        document.body.removeChild(tempTextArea);

        // 显示提示信息
        alert('文本已复制到剪贴板！');
    }
</script>
</body>
</html>
